package handler

import (
	"github.com/gin-gonic/gin"
	"go-graduation/service/internal/service"
	"strconv"
)

type ArticleApi struct {
	ArticleService *service.ArticleService
}

func (s ArticleApi) GetArticle(c *gin.Context) {
	id, _ := strconv.Atoi(c.Param("id"))
	u, err := s.ArticleService.GetArticle(c, id)
	if err != nil {
		c.JSON(500, err)
		return
	}
	c.JSON(200, u)
}
